package com.hansming.bss.modules.sfc.service;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hansming.bss.common.service.CrudService;
import com.hansming.bss.modules.sfc.dao.CityDao;
import com.hansming.bss.modules.sfc.entity.City;

/**
 * 城市Service
 * @author Hansming
 * @version 2017-09-19
 */
@Service
@Transactional(readOnly = true)
public class CityService extends CrudService<CityDao,City>{
	
	@Autowired
	private CityDao cityDao;
	
	public City getbyid(String id){
		return cityDao.getbyid(id);
	}
	
	//查出主页设置的城市引导
	public List<City> selectByIn_cmenu(){
		return cityDao.selectByIn_cmenu();	
	}
	
	//根据线路城市分类查出城市集合
	public List<City> selectByType(String type){
		return cityDao.selectByType(type);
	}
	
	//设置为首页导航栏的城市
	public int	 updateCityInMenu(City city){
		return cityDao.updateCityInMenu(city);
	}
	
	//取消设置其为首页导航栏的城市
	public int deleteCityInMenu(City city){
		return cityDao.deleteCityInMenu(city);
	}
	
	//得到设为首页展示的城市有多少
	public int getCityInMenu(){
		return cityDao.getCityInMenu();
	}
		
	//得到设为线路首页展示的城市有多少
	public int getCityInlinepage(){
		return cityDao.getCityInlinepage();
	}

	
	//得到租车热门城市
	public List<City> getCityInhotflag(){
		return cityDao.getCityInhotflag();
	}
	
	//根据输入的内容查找到可能的所有城市
	public List<City> searchCity(City city){			
		return cityDao.searchCity(city);
	}
	
	//得到线路首页的城市集合
		public List<City> getCitysInlinepage(){
			return cityDao.getCitysInlinepage();
		}
		
		
		
	//===========小程序用service=====================
		public List<City> getthreeCitybyLineType(String type){
			return cityDao.getthreeCitybyLineType(type);
		}
		
		//展示在租车首页搜索栏上的城市
		public List<City> selectCityInIndex(){
			return cityDao.selectCityInIndex();
		}
		
		//选择展示
		@Transactional(readOnly = false)
		public void updateCityInCarIndex(City city){
			cityDao.updateCityInCarIndex(city);
		}
		
		//取消展示
		@Transactional(readOnly = false)
		public void  cancleUpdateCityIndex(City city){
			cityDao.cancleUpdateCityIndex(city);
		}
		
		@Transactional(readOnly = false)
		public void updatesort(City city){
			cityDao.updatesort(city);
		}
		
		//根据字母来找城市信息
		public List<City> getCityByLetter(String letter){
			return cityDao.getCityByLetter(letter);


		}
}
